package edu.online.dal;

import edu.online.entity.SwitchOrderEntity;
import org.apache.ibatis.jdbc.SQL;

public class SwitchOrderEntitySqlProvider {

    public String insertSelective(SwitchOrderEntity record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("switchorder");
        
        if (record.getSwitchorderid() != null) {
            sql.VALUES("SwitchOrderID", "#{switchorderid,jdbcType=CHAR}");
        }
        
        if (record.getAdminuserid() != null) {
            sql.VALUES("AdminUserId", "#{adminuserid,jdbcType=CHAR}");
        }
        
        if (record.getRequesttime() != null) {
            sql.VALUES("RequestTime", "#{requesttime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getConfirmtime() != null) {
            sql.VALUES("ConfirmTime", "#{confirmtime,jdbcType=TIMESTAMP}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(SwitchOrderEntity record) {
        SQL sql = new SQL();
        sql.UPDATE("switchorder");
        
        if (record.getAdminuserid() != null) {
            sql.SET("AdminUserId = #{adminuserid,jdbcType=CHAR}");
        }
        
        if (record.getRequesttime() != null) {
            sql.SET("RequestTime = #{requesttime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getConfirmtime() != null) {
            sql.SET("ConfirmTime = #{confirmtime,jdbcType=TIMESTAMP}");
        }
        
        sql.WHERE("SwitchOrderID = #{switchorderid,jdbcType=CHAR}");
        
        return sql.toString();
    }
}